package com.bugsnag.ohos;

import java.util.Map;

/**
 * StateEvent
 *
 * @since 2021-07-01
 */
public class StateEvent {
    /**
     * Install
     *
     * @since 2021-07-27
     */
    public static class Install extends StateEvent {
        private static String apiKey;
        private static boolean autoDetectNdkCrashes;
        private static String appVersion;
        private static String buildUuid;
        private static String releaseStage;
        private static String lastRunInfoPath;
        private static int consecutiveLaunchCrashes;

        /**
         * constructor
         *
         * @param apiKey
         * @param autoDetectNdkCrashes
         * @param appVersion
         * @param buildUuid
         * @param releaseStage
         * @param lastRunInfoPath
         * @param consecutiveLaunchCrashes
         */
        public Install(String apiKey, boolean autoDetectNdkCrashes, String appVersion, String buildUuid,
                       String releaseStage, String lastRunInfoPath, int consecutiveLaunchCrashes) {
            this.apiKey = apiKey;
            this.autoDetectNdkCrashes = autoDetectNdkCrashes;
            this.appVersion = appVersion;
            this.buildUuid = buildUuid;
            this.releaseStage = releaseStage;
            this.lastRunInfoPath = lastRunInfoPath;
            this.consecutiveLaunchCrashes = consecutiveLaunchCrashes;
        }

        public static String getApiKey() {
            return apiKey;
        }

        public static boolean isAutoDetectNdkCrashes() {
            return autoDetectNdkCrashes;
        }

        public static String getAppVersion() {
            return appVersion;
        }

        public static String getBuildUuid() {
            return buildUuid;
        }

        public static String getReleaseStage() {
            return releaseStage;
        }

        public static String getLastRunInfoPath() {
            return lastRunInfoPath;
        }

        public static int getConsecutiveLaunchCrashes() {
            return consecutiveLaunchCrashes;
        }
    }

    /**
     * DeliverPending
     *
     * @since 2021-07-27
     */
    public static class DeliverPending extends StateEvent {
    }

    /**
     * AddMetadata
     *
     * @since 2021-07-27
     */
    public static class AddMetadata extends StateEvent {
        private String section;
        private String key;
        private Object value;

        /**
         * constructor
         *
         * @param section
         * @param key
         * @param value
         */
        public AddMetadata(String section, String key, Object value) {
            this.section = section;
            this.key = key;
            this.value = value;
        }

        public String getSection() {
            return section;
        }

        public String getKey() {
            return key;
        }

        public Object getValue() {
            return value;
        }
    }

    /**
     * ClearMetadataSection
     *
     * @since 2021-07-27
     */
    public static class ClearMetadataSection extends StateEvent {
        private String section;

        /**
         * constructor
         *
         * @param section
         */
        public ClearMetadataSection(String section) {
            this.section = section;
        }

        public String getSection() {
            return section;
        }
    }

    /**
     * ClearMetadataValue
     *
     * @since 2021-07-27
     */
    public static class ClearMetadataValue extends StateEvent {
        private String section;
        private String key;

        /**
         * constructor
         *
         * @param section
         * @param key
         */
        public ClearMetadataValue(String section, String key) {
            this.section = section;
            this.key = key;
        }

        public String getSection() {
            return section;
        }

        public String getKey() {
            return key;
        }
    }

    /**
     * AddBreadcrumb
     *
     * @since 2021-07-27
     */
    public static class AddBreadcrumb extends StateEvent {
        private String message;
        private BreadcrumbType type;
        private String timestamp;
        private Map<String, Object> metadata;

        /**
         * constructor
         *
         * @param message
         * @param type
         * @param timestamp
         * @param metadata
         */
        public AddBreadcrumb(String message, BreadcrumbType type, String timestamp, Map<String, Object> metadata) {
            this.message = message;
            this.type = type;
            this.timestamp = timestamp;
            this.metadata = metadata;
        }

        public String getMessage() {
            return message;
        }

        public BreadcrumbType getType() {
            return type;
        }

        public String getTimestamp() {
            return timestamp;
        }

        public Map<String, Object> getMetadata() {
            return metadata;
        }
    }

    /**
     * NotifyHandled
     *
     * @since 2021-07-27
     */
    public static class NotifyHandled extends StateEvent {
        /**
         * state event instance
         */
        public static final StateEvent INSTANCE = new NotifyHandled();
    }

    /**
     * NotifyUnhandled
     *
     * @since 2021-07-27
     */
    public static class NotifyUnhandled extends StateEvent {
        /**
         * state event instance
         */
        public static final StateEvent INSTANCE = new NotifyUnhandled();
    }

    /**
     * PauseSession
     *
     * @since 2021-07-27
     */
    public static class PauseSession extends StateEvent {
        /**
         * state event instance
         */
        public static final StateEvent INSTANCE = new PauseSession();
    }

    /**
     * StartSession
     *
     * @since 2021-07-27
     */
    public static class StartSession extends StateEvent {
        private String id;
        private String startedAt;
        private int handledCount;
        private int unhandledCount;

        /**
         * constructor
         *
         * @param id
         * @param startedAt
         * @param handledCount
         * @param unhandledCount
         */
        public StartSession(String id, String startedAt, int handledCount, int unhandledCount) {
            this.id = id;
            this.startedAt = startedAt;
            this.handledCount = handledCount;
            this.unhandledCount = unhandledCount;
        }

        public int getUnhandledCount() {
            return unhandledCount;
        }

        public String getId() {
            return id;
        }

        public String getStartedAt() {
            return startedAt;
        }

        public int getHandledCount() {
            return handledCount;
        }
    }

    /**
     * UpdateContext
     *
     * @since 2021-07-27
     */
    public static class UpdateContext extends StateEvent {
        private String context;

        /**
         * constructor
         *
         * @param context
         */
        public UpdateContext(String context) {
            this.context = context;
        }

        public String getContext() {
            return context;
        }
    }

    /**
     * UpdateInForeground
     *
     * @since 2021-07-27
     */
    public static class UpdateInForeground extends StateEvent {
        private boolean inForeground;
        private String contextActivity;

        /**
         * constructor
         *
         * @param inForeground
         * @param contextActivity
         */
        public UpdateInForeground(boolean inForeground, String contextActivity) {
            this.inForeground = inForeground;
            this.contextActivity = contextActivity;
        }

        public boolean isInForeground() {
            return inForeground;
        }

        public String getContextAbility() {
            return contextActivity;
        }
    }

    /**
     * UpdateLastRunInfo
     *
     * @since 2021-07-27
     */
    public static class UpdateLastRunInfo extends StateEvent {
        private int consecutiveLaunchCrashes;

        /**
         * constructor
         *
         * @param consecutiveLaunchCrashes
         */
        public UpdateLastRunInfo(int consecutiveLaunchCrashes) {
            this.consecutiveLaunchCrashes = consecutiveLaunchCrashes;
        }

        public int getConsecutiveLaunchCrashes() {
            return consecutiveLaunchCrashes;
        }
    }

    /**
     * UpdateIsLaunching
     *
     * @since 2021-07-27
     */
    public static class UpdateIsLaunching extends StateEvent {
        private boolean isLaunching;

        /**
         * constructor
         *
         * @param isLaunching
         */
        public UpdateIsLaunching(boolean isLaunching) {
            this.isLaunching = isLaunching;
        }

        public boolean isLaunching() {
            return isLaunching;
        }
    }

    /**
     * UpdateOrientation
     *
     * @since 2021-07-27
     */
    public static class UpdateOrientation extends StateEvent {
        private String orientation;

        /**
         * constructor
         *
         * @param orientation
         */
        public UpdateOrientation(String orientation) {
            this.orientation = orientation;
        }

        public String getOrientation() {
            return orientation;
        }
    }

    /**
     * UpdateUser
     *
     * @since 2021-07-27
     */
    public static class UpdateUser extends StateEvent {
        private User user;

        /**
         * constructor
         *
         * @param user
         */
        public UpdateUser(User user) {
            this.user = user;
        }

        public User getUser() {
            return user;
        }
    }

    /**
     * UpdateMemoryTrimEvent
     *
     * @since 2021-07-27
     */
    public static class UpdateMemoryTrimEvent extends StateEvent {
        private static boolean isLowMemory;

        /**
         * constructor
         *
         * @param user
         */
        public UpdateMemoryTrimEvent(boolean user) {
            this.isLowMemory = isLowMemory;
        }

        public static boolean isLowMemory() {
            return isLowMemory;
        }
    }
}
